/*
 * GwtYuiCarousel - API to integrate YUI Carousel in GWT framework
 *
 * Copyright (c) 2007, Nicolas Hoppenot
 *
 * This free software is licensed under the Apache License, Version 2.0 (the "License").
 * To obtain a copy of the licence, visit : http://www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed WITHOUT ANY WARRANTY OR CONDITION OF ANY KIND.
 * Please see the license for more information.
 *
 * Version $0.6.1-beta1$
 */
package com.gwtyuicarousel.client.ui;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.Element;
import com.gwtyuicarousel.client.util.JsArrayUtil;

/**
 * The methods of this class are very close to the functions of Carousel
 * javascript object. Please see the documentation of the component here :
 * http://billwscott.com/carousel/#methods
 * 
 * Please note that indexes in this API are not starting from 1, but 0. The
 * small others differences are listed in the methods javadoc. In most of the
 * cases, there is no processing : it only calls the javascript method of the
 * same signature.
 * 
 * @version $0.6.1-beta1$
 * @author Nicolas Hoppenot
 * 
 */
public class Carousel {

	/**
	 * Used to define the possible values for the Orientation. cf.
	 * http://billwscott.com/carousel/#properties. The two possible values are
	 * "horizontal" or "vertical".
	 * 
	 * @version $0.6.1-beta1$
	 * @author Nicolas Hoppenot
	 * 
	 */
	public static class Orientation {

		/** The value for this orientation in javascript code */
		private String orientationValue;

		private Orientation(String orientationValue) {
			this.orientationValue = orientationValue;
		}

		/** Get the value of the orientation in the javascript code */
		public String toString() {
			return orientationValue;
		}

		/** Constant to use for Horizontal orientation */
		public final static Orientation HORIZONTAL = new Orientation(
				"horizontal");

		/** Constant to use for vertical orientation */
		public final static Orientation VERTICAL = new Orientation("vertical");

	}

	/**
	 * Define the YAHOO.util.Easing animation methods of the YUI library. For
	 * more information about these methods, please see
	 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html. One
	 * constant by method is created. These methods are used to set the
	 * "animationMethod" property of the carousel. For more information about
	 * this property, please see http://billwscott.com/carousel/#properties.
	 * 
	 * @version $0.6.1-beta1$
	 * @author Nicolas Hoppenot
	 * 
	 */
	public static class AnimationMethod {

		/**
		 * Animation method YAHOO.util.Easing.easeNone. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod EASE_NONE = new AnimationMethod(
				"easeNone");

		/**
		 * Animation method YAHOO.util.Easing.easeIn. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod EASE_IN = new AnimationMethod(
				"easeIn");

		/**
		 * Animation method YAHOO.util.Easing.easeOut. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod EASE_OUT = new AnimationMethod(
				"easeOut");

		/**
		 * Animation method YAHOO.util.Easing.easeBoth. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod EASE_BOTH = new AnimationMethod(
				"easeBoth");

		/**
		 * Animation method YAHOO.util.Easing.easeInStrong. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod EASE_IN_STRONG = new AnimationMethod(
				"easeInStrong");

		/**
		 * Animation method YAHOO.util.Easing.easeOutStrong. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod EASE_OUT_STRONG = new AnimationMethod(
				"easeOutStrong");

		/**
		 * Animation method YAHOO.util.Easing.easeBothStrong. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod EASE_BOTH_STRONG = new AnimationMethod(
				"easeBothStrong");

		/**
		 * Animation method YAHOO.util.Easing.elasticIn. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod ELASTIC_IN = new AnimationMethod(
				"elasticIn");

		/**
		 * Animation method YAHOO.util.Easing.elasticOut. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod ELASTIC_OUT = new AnimationMethod(
				"elasticOut");

		/**
		 * Animation method YAHOO.util.Easing.elasticBoth. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod ELASTIC_BOTH = new AnimationMethod(
				"elasticBoth");

		/**
		 * Animation method YAHOO.util.Easing.backIn. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod BACK_IN = new AnimationMethod(
				"backIn");

		/**
		 * Animation method YAHOO.util.Easing.backIn. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod BACK_OUT = new AnimationMethod(
				"backOut");

		/**
		 * Animation method YAHOO.util.Easing.backBoth. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod BACK_BOTH = new AnimationMethod(
				"backBoth");

		/**
		 * Animation method YAHOO.util.Easing.bounceIn. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod BOUNCE_IN = new AnimationMethod(
				"bounceIn");

		/**
		 * Animation method YAHOO.util.Easing.bounceIn. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod BOUNCE_OUT = new AnimationMethod(
				"bounceOut");

		/**
		 * Animation method YAHOO.util.Easing.bounceBoth. cf.
		 * http://developer.yahoo.com/yui/docs/animation/YAHOO.util.Easing.html
		 */
		public final static AnimationMethod BOUNCE_BOTH = new AnimationMethod(
				"bounceBoth");

		/** Contains all the animation methods */
		public static AnimationMethod[] animationMethods = { BACK_BOTH,
				BACK_IN, BACK_OUT, BOUNCE_BOTH, BOUNCE_IN, BOUNCE_OUT,
				EASE_BOTH, EASE_BOTH_STRONG, EASE_IN, EASE_IN_STRONG,
				EASE_NONE, EASE_OUT, EASE_OUT_STRONG, ELASTIC_BOTH, ELASTIC_IN,
				ELASTIC_OUT };

		public static AnimationMethod getAnimationMethod(
				JavaScriptObject jsAnimationMethod) {
			for (int index = 0; index < animationMethods.length; index++) {
				if (animationMethods[index].getJsAnimationMethod().equals(
						jsAnimationMethod)) {
					return animationMethods[index];
				}
			}
			throw new IllegalArgumentException("The method : "
					+ jsAnimationMethod + "is unknown.");
		}

		/** The javascript object reference of the animation method */
		private JavaScriptObject jsAnimationMethod;

		/** Contains the animation method name */
		private String animationMethodName;

		/**
		 * Instanciate a new animation method.
		 * 
		 * @param animationMethodName
		 *            The name of the animation method in the javascript domain
		 *            YAHOO.util.Easing. For example, if animationMethod =
		 *            easingNone, the javascript method referenced is
		 *            YAHOO.util.Easing.easingNone.
		 */
		private AnimationMethod(String animationMethodName) {
			this.animationMethodName = animationMethodName;
			this.jsAnimationMethod = getEasyAnimationMethod(animationMethodName);
			if (jsAnimationMethod == null) {
				throw new IllegalArgumentException("The animation method : "
						+ animationMethodName
						+ " does not exists in singleton YAHOO.util.Easing.");
			}
		}

		private static native JavaScriptObject getEasyAnimationMethod(
				String methodName) /*-{
		                                                       return $wnd.YAHOO.util.Easing[methodName];
		                                                       }-*/;

		/**
		 * @return the animationMethodName
		 */
		public String getAnimationMethodName() {
			return animationMethodName;
		}

		/**
		 * @return the jsAnimationMethod
		 */
		public JavaScriptObject getJsAnimationMethod() {
			return jsAnimationMethod;
		}

	}

	/**
	 * Used to define the possible values for the Direction. Define constants
	 * for two possible values : "next" or "previous". For more information
	 * about these values, please see
	 * http://billwscott.com/carousel/#properties.
	 * 
	 * @version $0.6.1-beta1$
	 * @author Nicolas Hoppenot
	 * 
	 */
	public static class Direction {

		/** The value for this direction in javascript code */
		private String directionValue;

		private Direction(String directionValue) {
			this.directionValue = directionValue;
		}

		/** Get the value of the direction in the javascript code */
		public String toString() {
			return directionValue;
		}

		/** Constant to use for next direction */
		public final static Direction NEXT = new Direction("next");

		/** Constant to use for previous direction */
		public final static Direction PREVIOUS = new Direction("previous");

	}

	/**
	 * Creation of the javascript instance, with a pre-defined configuration.
	 * 
	 * @param elementId
	 *            The ID of the HTML element which is the root element of the
	 *            carousel.
	 * @param config
	 *            The configuration of the carousel
	 * @return The carousel javascript object.
	 */
	private static native JavaScriptObject create(String elementId,
			JavaScriptObject config)/*-{
	                                     return new $wnd.YAHOO.extension.Carousel(elementId, config);
	                                     }-*/;

	/**
	 * Creation of a carousel javascript instance.
	 * 
	 * @param elementId
	 *            The ID of the HTML element which is the root element of the
	 *            carousel.
	 * @return The carousel javascript object.
	 */
	private static native JavaScriptObject create(String elementId)/*-{
	                                     var carouselJs = new $wnd.YAHOO.extension.Carousel(elementId);
	                                     carouselJs.setProperty("prevElement", []);
	                                     carouselJs.setProperty("nextElement", []);
	                                     return carouselJs;
	                                     }-*/;

	/**
	 * Contains the reference to the carousel javascript object;
	 */
	private JavaScriptObject javascriptObject;

	/**
	 * Create a carousel with a pre-defined configuration.
	 * 
	 * @param elementId
	 *            The ID of the root HTML element of the carousel
	 * @param config
	 *            The configuration of the carousel
	 */
	protected Carousel(String elementId, CarouselConfig config) {
		super();
		if (config == null) {
			javascriptObject = create(elementId);
		} else {
			if (config.getCarouselListener() != null) {
				config.setLoadOnStart(false);
				javascriptObject = create(elementId, config
						.getJavascriptObject());
				setCarouselListener(config.getCarouselListener());
			} else {
				javascriptObject = create(elementId, config
						.getJavascriptObject());
			}
		}
	}

	/**
	 * Create a carousel, without predefining its configuration.
	 * 
	 * @param elementId
	 *            The ID of the root HTML element of the carousel
	 */
	protected Carousel(String elementId) {
		this(elementId, null);
	}

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.addItem function.
	 * For more information, please see http://billwscott.com/carousel/#methods. <br/>
	 * The index is a 0 based index.
	 */
	public native Element addItem(int index, String innerHtml,
			String liClassName) /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.addItem(index + 1, innerHtml, liClassName);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.addItem function.
	 * For more information, please see http://billwscott.com/carousel/#methods. <br/>
	 * The index is a 0 based index.
	 */
	public native Element addItem(int index, String innerHtml) /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.addItem(index + 1, innerHtml);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.addItem function.
	 * For more information, please see http://billwscott.com/carousel/#methods. <br/>
	 * The index is a 0 based index.
	 */
	public native Element addItem(int index, Element itemElement,
			String liClassName) /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.addItem(index + 1, itemElement, liClassName);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.addItem function.
	 * For more information, please see http://billwscott.com/carousel/#methods. <br/>
	 * The index is a 0 based index.
	 */
	public native Element addItem(int index, Element itemElement) /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.addItem(index + 1, itemElement);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.calculateSize
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods
	 */
	public native void calculateSize() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.calculateSize();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.clear function.
	 * For more information, please see http://billwscott.com/carousel/#methods
	 */
	public native void clear() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.clear();
	                   }-*/;

	/**
	 * Call to the javascript YAHOO.extension.Carousel.getFirstItemRevealed
	 * function and return null if no first item is revealed or if the index of
	 * the first visible is equal to 0. (nothing to reveal) : in the original
	 * javascript method, the returned value in this case is -1. The returned
	 * index is a 0 based index.
	 * 
	 * @see #getFirstItemRevealedJs()
	 * 
	 */
	public Integer getFirstItemRevealed() {
		int index = getFirstItemRevealedJs();
		if (index >= 0) {
			return new Integer(index - 1);
		}
		return null;
	}

	/**
	 * Make a call to the javascript
	 * YAHOO.extension.Carousel.getFirstItemRevealed function. For more
	 * information, please see http://billwscott.com/carousel/#methods. Has a
	 * private visibility : it's more appropriate to use the method
	 * {@link #getFirstItemRevealed()}
	 */
	private native int getFirstItemRevealedJs() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getFirstItemRevealed();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.getFirstVisible
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.<br/>
	 * The returned index is a 0 based index.
	 */
	public native int getFirstVisible() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getFirstVisible() - 1;
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.getItem function.
	 * For more information, please see http://billwscott.com/carousel/#methods.<br/>
	 * The returned index is a 0 based index.
	 */
	public native Element getItem(int itemIndex) /*-{
	 value = 
	this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getItem
	(itemIndex + 1);
	 return (value == null) ? null : value;
	}-*/;

	/**
	 * Call to the javascript YAHOO.extension.Carousel.getLastItemRevealed
	 * function and return null if no last item is revealed or if the index of
	 * the first visible is equal to size-1. (nothing to reveal) : in the
	 * original javascript method, the returned value in this case is -1. The
	 * returned index is a 0 based index.
	 */
	public Integer getLastItemRevealed() {
		int index = getLastItemRevealedJs();
		if (index >= 0) {
			return new Integer(index - 1);
		}
		return null;
	}

	/**
	 * Make a call to the javascript
	 * YAHOO.extension.Carousel.getLastItemRevealed function. For more
	 * information, please see http://billwscott.com/carousel/#methods. Has a
	 * private visibility : it's more appropriate to use the method
	 * {@link #getLastItemRevealed()}
	 */
	private native int getLastItemRevealedJs() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getLastItemRevealed();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.getLastVisible
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. <br/>
	 * The index is a 0 based index.
	 */
	public native int getLastVisible() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getLastVisible() - 1;
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.hide function. For
	 * more information, please see http://billwscott.com/carousel/#methods.
	 */
	public native void hide() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.hide();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.moveTo function.
	 * For more information, please see http://billwscott.com/carousel/#methods. <br/>
	 * The index is a 0 based index.
	 */
	public native void moveTo(int index) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.moveTo(index + 1);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.reload function.
	 * For more information, please see http://billwscott.com/carousel/#methods.
	 */
	public native void reload() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.reload();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.reload function.
	 * For more information, please see http://billwscott.com/carousel/#methods.
	 */
	public native void reload(int numVisible) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.reload(numVisible);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.scrollTo function.
	 * For more information, please see http://billwscott.com/carousel/#methods.
	 */
	public native void scrollTo(int index) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.scrollTo(index + 1);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.scrollNext
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void scrollNext() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.scrollNext();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.scrollPrev
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void scrollPrev() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.scrollPrev();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.show function. For
	 * more information, please see http://billwscott.com/carousel/#methods.
	 */
	public native void show() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.show();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.startAutoPlay
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void startAutoPlay() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.startAutoPlay();
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.startAutoPlay
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void startAutoPlay(int interval) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.startAutoPlay(interval);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.stopAutoPlay
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void stopAutoPlay() /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.stopAutoPlay();
	                   }-*/;

	/**
	 * Add the object permitting to handle the carousel events. To have more
	 * informations about these events, please see
	 * http://billwscott.com/carousel/#properties. The
	 * YAHOO.extension.Carousel.reload() method is called after the properties
	 * setup, in order the carousel take in account the modifications.
	 * 
	 * @param carouselListener
	 *            The carousel event listener
	 */
	public void setCarouselListener(CarouselListener carouselListener) {
		setCarouselListener(carouselListener, true);
	}

	/**
	 * Add the object permitting to handle the carousel events. To have more
	 * informations about these events, please see
	 * http://billwscott.com/carousel/#properties.
	 * 
	 * @param carouselListener
	 *            The carousel event listener
	 * @param reload
	 *            True if the reload method have to be called after the handlers
	 *            have been setted
	 */
	public native void setCarouselListener(CarouselListener carouselListener,
			boolean reload) /*-{
	                   var gwtYuiCarousel = this;
	                   
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty('loadNextHandler', function(type, arg) {
	                   carouselListener.@com.gwtyuicarousel.client.ui.CarouselListener::onLoadNext(Lcom/gwtyuicarousel/client/ui/Carousel;IIZ)(gwtYuiCarousel, arg[0]-1, arg[1]-1, arg[2]);
	                   });
	                   
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty('loadPrevHandler', function(type, arg) {
	                   carouselListener.@com.gwtyuicarousel.client.ui.CarouselListener::onLoadPrevious(Lcom/gwtyuicarousel/client/ui/Carousel;IIZ)(gwtYuiCarousel, arg[0]-1, arg[1]-1, arg[2]);
	                   });

	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty('prevButtonStateHandler', function(type, arg) {
	                   carouselListener.@com.gwtyuicarousel.client.ui.CarouselListener::onPrevButtonStateChange(Lcom/gwtyuicarousel/client/ui/Carousel;[Lcom/google/gwt/user/client/Element;Z)(gwtYuiCarousel, @com.gwtyuicarousel.client.util.JsArrayUtil::convertJsToElementArray(Lcom/google/gwt/core/client/JavaScriptObject;)(arg[1]), arg[0]);
	                   });

	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty('nextButtonStateHandler', function(type, arg) {
	                   carouselListener.@com.gwtyuicarousel.client.ui.CarouselListener::onNextButtonStateChange(Lcom/gwtyuicarousel/client/ui/Carousel;[Lcom/google/gwt/user/client/Element;Z)(gwtYuiCarousel, @com.gwtyuicarousel.client.util.JsArrayUtil::convertJsToElementArray(Lcom/google/gwt/core/client/JavaScriptObject;)(arg[1]), arg[0]);
	                   });
	                   
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty('animationCompleteHandler', function(type, arg) {
	                   var direction = arg[0];
	                   if (direction == 'next') {
	                   carouselListener.@com.gwtyuicarousel.client.ui.CarouselListener::onAnimationComplete(Lcom/gwtyuicarousel/client/ui/Carousel;Lcom/gwtyuicarousel/client/ui/Carousel$Direction;)(gwtYuiCarousel, @com.gwtyuicarousel.client.ui.Carousel$Direction::NEXT);
	                   }
	                   if (direction == 'previous') {
	                   carouselListener.@com.gwtyuicarousel.client.ui.CarouselListener::onAnimationComplete(Lcom/gwtyuicarousel/client/ui/Carousel;Lcom/gwtyuicarousel/client/ui/Carousel$Direction;)(gwtYuiCarousel, @com.gwtyuicarousel.client.ui.Carousel$Direction::PREVIOUS);
	                   }
	                   }); 

	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty('loadInitHandler', function(type, arg) {
	                   carouselListener.@com.gwtyuicarousel.client.ui.CarouselListener::onLoadInit(Lcom/gwtyuicarousel/client/ui/Carousel;IIZ)(gwtYuiCarousel, arg[0]-1, arg[1]-1, arg[2]);
	                   });

	                   if (reload) {
	                     this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.reload();
	                   }
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.insertBefore
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void insertBefore(int index, String innnerHtml) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.insertBefore(index + 1, innnerHtml);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.insertAfter
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void insertAfter(int index, String innerHtml) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.insertAfter(index + 1, innerHtml);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.insertBefore
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void insertBefore(int index, Element itemElement) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.insertBefore(index + 1, itemElement);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.insertAfter
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods.
	 */
	public native void insertAfter(int index, Element itemElement) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.insertAfter(index + 1, itemElement);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is an int
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native void setProperty(String propertyName, int value,
			boolean silent) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value, silent);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is an int
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native void setProperty(String propertyName, int value) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.getProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The returned value is a string.
	 * This method has a private visibility because getters and setters to all
	 * the carousel properties have been written in this class, so better to use
	 * these getters and setters.
	 */
	private native String getStringProperty(String property) /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getProperty(property);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.getProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The returned value is a int
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native int getIntProperty(String property) /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getProperty(property);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.getProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The returned value is a boolean
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native boolean getBooleanProperty(String property) /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getProperty(property);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is a boolean
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native void setProperty(String propertyName, boolean value,
			boolean silent) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value, silent);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is a boolean
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native void setProperty(String propertyName, boolean value) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is a String
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native void setProperty(String propertyName, String value,
			boolean silent) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value, silent);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is a String
	 * value. This method has a private visibility because getters and setters
	 * to all the carousel properties have been written in this class, so better
	 * to use these getters and setters.
	 */
	private native void setProperty(String propertyName, String value) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is a
	 * JavaScriptObject. This method has a private visibility because getters
	 * and setters to all the carousel properties have been written in this
	 * class, so better to use these getters and setters.
	 */
	private native void setProperty(String propertyName, JavaScriptObject value) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value);
	                   }-*/;

	/**
	 * Make a call to the javascript YAHOO.extension.Carousel.setProperty
	 * function. For more information, please see
	 * http://billwscott.com/carousel/#methods. The value to set is a
	 * JavaScriptObject. This method has a private visibility because getters
	 * and setters to all the carousel properties have been written in this
	 * class, so better to use these getters and setters.
	 */
	private native void setProperty(String propertyName,
			JavaScriptObject value, boolean silent) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty(propertyName, value, silent);
	                   }-*/;

	/**
	 * Set the "firstVisible" property by calling
	 * {@link #setProperty(String, int)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties. The
	 * index is a 0 based index.
	 */
	public void setFirstVisible(int firstVisible) {
		setProperty("firstVisible", firstVisible + 1);
	}

	/**
	 * Set the "firstVisible" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties. The index is a 0 based index.
	 */
	public void setFirstVisible(int firstVisible, boolean silent) {
		setProperty("firstVisible", firstVisible + 1, silent);
	}

	/**
	 * Set the "loadOnStart" property by calling
	 * {@link #setProperty(String, boolean)}. To have more informations about
	 * this property, please see http://billwscott.com/carousel/#properties.
	 */
	public void setLoadOnStart(boolean loadOnStart) {
		setProperty("loadOnStart", loadOnStart);
	}

	/**
	 * Set the "loadOnStart" property by calling
	 * {@link #setProperty(String, boolean, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setLoadOnStart(boolean loadOnStart, boolean silent) {
		setProperty("loadOnStart", loadOnStart, silent);
	}

	/**
	 * Get the "loadOnStart" property by calling
	 * {@link #getBooleanProperty(String)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public boolean getLoadOnStart() {
		return getBooleanProperty("loadOnStart");
	}

	/**
	 * Set the "size" property by calling {@link #setProperty(String, int)}. To
	 * have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setSize(int size) {
		setProperty("size", size);
	}

	/**
	 * Set the "size" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setSize(int size, boolean silent) {
		setProperty("size", size, silent);
	}

	/**
	 * Get the "size" property by calling {@link #getIntProperty(String)}. To
	 * have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public int getSize() {
		return getIntProperty("size");
	}

	/**
	 * Set the "scrollBeforeAmount" property by calling
	 * {@link #setProperty(String, int)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public void setScrollBeforeAmount(int scrollBeforeAmount) {
		setProperty("scrollBeforeAmount", scrollBeforeAmount);
	}

	/**
	 * Set the "scrollBeforeAmount" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setScrollBeforeAmount(int scrollBeforeAmount, boolean silent) {
		setProperty("scrollBeforeAmount", scrollBeforeAmount, silent);
	}

	/**
	 * Get the "scrollBeforeAmount" property by calling
	 * {@link #getIntProperty(String)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public int getScrollBeforeAmount() {
		return getIntProperty("scrollBeforeAmount");
	}

	/**
	 * Set the "scrollAfterAmount" property by calling
	 * {@link #setProperty(String, int)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public void setScrollAfterAmount(int scrollAfterAmount) {
		setProperty("scrollAfterAmount", scrollAfterAmount);
	}

	/**
	 * Set the "scrollAfterAmount" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setScrollAfterAmount(int scrollAfterAmount, boolean silent) {
		setProperty("scrollAfterAmount", scrollAfterAmount, silent);
	}

	/**
	 * Get the "scrollAfterAmount" property by calling
	 * {@link #getIntProperty(String)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public int getScrollAfterAmount() {
		return getIntProperty("scrollAfterAmount");
	}

	/**
	 * Set the "numVisible" property by calling
	 * {@link #setProperty(String, int)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public void setNumVisible(int numVisible) {
		setProperty("numVisible", numVisible);
	}

	/**
	 * Set the "numVisible" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setNumVisible(int numVisible, boolean silent) {
		setProperty("numVisible", numVisible, silent);
	}

	/**
	 * Get the "numVisible" property by calling {@link #getIntProperty(String)}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public int getNumVisible() {
		return getIntProperty("numVisible");
	}

	/**
	 * Set the "scrollInc" property by calling {@link #setProperty(String, int)}
	 * . To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setScrollInc(int scrollInc) {
		setProperty("scrollInc", scrollInc);
	}

	/**
	 * Set the "scrollInc" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setScrollInc(int scrollInc, boolean silent) {
		setProperty("scrollInc", scrollInc, silent);
	}

	/**
	 * Get the "scrollInc" property by calling {@link #getIntProperty(String)}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public int getScrollInc() {
		return getIntProperty("scrollInc");
	}

	/**
	 * Set the "wrap" property by calling {@link #setProperty(String, boolean)}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setWrap(boolean wrap) {
		setProperty("wrap", wrap);
	}

	/**
	 * Set the "wrap" property by calling
	 * {@link #setProperty(String, boolean, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setWrap(boolean wrap, boolean silent) {
		setProperty("wrap", wrap, silent);
	}

	/**
	 * Get the "wrap" property by calling {@link #getBooleanProperty(String)}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public boolean getWrap() {
		return getBooleanProperty("wrap");
	}

	/**
	 * Set the "revealAmount" property by calling
	 * {@link #setProperty(String, int)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public void setRevealAmount(int revealAmount) {
		setProperty("revealAmount", revealAmount);
	}

	/**
	 * Set the "revealAmount" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setRevealAmount(int revealAmount, boolean silent) {
		setProperty("revealAmount", revealAmount, silent);
	}

	/**
	 * Get the "revealAmount" property by calling
	 * {@link #getIntProperty(String)}. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 */
	public int getRevealAmount() {
		return getIntProperty("revealAmount");
	}

	/**
	 * Set the "navMargin" property by calling {@link #setProperty(String, int)}
	 * . To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setNavMargin(int navMargin) {
		setProperty("navMargin", navMargin);
	}

	/**
	 * Set the "navMargin" property by calling
	 * {@link #setProperty(String, int, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setNavMargin(int navMargin, boolean silent) {
		setProperty("navMargin", navMargin, silent);
	}

	/**
	 * Get the "navMargin" property by calling {@link #getIntProperty(String)}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public int getNavMargin() {
		return getIntProperty("navMargin");
	}

	/**
	 * Set the "orientation" property by calling
	 * {@link #setProperty(String, String)}. To have more informations about
	 * this property, please see http://billwscott.com/carousel/#properties.
	 */
	public void setOrientation(Orientation orientation) {
		setProperty("orientation", orientation.toString());
	}

	/**
	 * Set the "orientation" property by calling
	 * {@link #setProperty(String, String, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setOrientation(Orientation orientation, boolean silent) {
		setProperty("orientation", orientation.toString(), silent);
	}

	/**
	 * Get the "orientation" property by calling
	 * {@link #getStringProperty(String)}. We use the getted String value to
	 * determine which Orientation instance to return. To have more informations
	 * about "orientation" property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public Orientation getOrientation() {
		String orientationValue = getStringProperty("orientation");
		if (orientationValue.equals(Orientation.HORIZONTAL.toString())) {
			return Orientation.HORIZONTAL;
		}
		if (orientationValue.equals(Orientation.VERTICAL.toString())) {
			return Orientation.VERTICAL;
		}
		return null;
	}

	/**
	 * Set the "animationSpeed" property. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties. The
	 * animation speed is in ms in gwt-yui-carousel project.
	 */
	public native void setAnimationSpeed(int animationSpeed) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty("animationSpeed", animationSpeed / 1000);
	                   }-*/;

	/**
	 * Set the "animationSpeed" property. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties. The
	 * animation speed is in ms in gwt-yui-carousel project.
	 */
	public native void setAnimationSpeed(int animationSpeed, boolean silent) /*-{
	                   this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.setProperty("animationSpeed", animationSpeed / 1000, silent);
	                   }-*/;

	/**
	 * Get the "animationSpeed" property. To have more informations about this
	 * property, please see http://billwscott.com/carousel/#properties.
	 * 
	 * @return The animation speed in ms
	 */
	public native int getAnimationSpeed() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getProperty("animationSpeed") * 1000;
	                   }-*/;

	/**
	 * Set the "animationMethod" property by calling
	 * {@link #setProperty(String, JavaScriptObject)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setAnimationMethod(AnimationMethod animationMethod) {
		setProperty("animationMethod", animationMethod.getJsAnimationMethod());
	}

	/**
	 * Set the "animationMethod" property by calling
	 * {@link #setProperty(String, JavaScriptObject, boolean)}. To have more
	 * informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setAnimationMethod(AnimationMethod animationMethod,
			boolean silent) {
		setProperty("animationMethod", animationMethod.getJsAnimationMethod(),
				silent);
	}

	/**
	 * Get the "animationMethod" property by calling
	 * {@link #getJsAnimationMethod()}. The returned javascript object permits
	 * to find the correct AnimationMethod instance. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public AnimationMethod getAnimationMethod() {
		JavaScriptObject jsObj = getJsAnimationMethod();
		if (jsObj == null) {
			return null;
		}
		return AnimationMethod.getAnimationMethod(jsObj);
	}

	/**
	 * Permits to get the reference to the javascript object of the animation
	 * method used.
	 */
	private native JavaScriptObject getJsAnimationMethod() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getProperty("animationMethod");
	                   }-*/;

	/**
	 * Set the "autoPlay" property by calling {@link #setProperty(String, int)}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setAutoPlay(int autoPlay) {
		setProperty("autoPlay", autoPlay);
	}

	/**
	 * Set the "autoPlay" property by calling
	 * {@link #setProperty(String, boolean, boolean)}. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setAutoPlay(int autoPlay, boolean silent) {
		setProperty("autoPlay", autoPlay, silent);
	}

	/**
	 * Get the "autoPlay" property by calling {@link #getIntProperty(String)}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public int getAutoPlay() {
		return getIntProperty("autoPlay");
	}

	/**
	 * Add an element to the "nextElement" list. To have more informations about
	 * this property, please see http://billwscott.com/carousel/#properties.
	 */
	public void addNextElement(Element nextElement, boolean silent) {
		JavaScriptObject nextElements = getJsNextElements();
		JsArrayUtil.addElementInJsArray(nextElements, nextElement);
		setProperty("nextElement", nextElements, silent);
	}

	/**
	 * Remove an element from the "nextElement" list. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void removeNextElement(Element nextElement, boolean silent) {
		JavaScriptObject nextElements = getJsNextElements();
		JsArrayUtil.removeElementInJsArray(nextElements, nextElement);
		setProperty("nextElement", nextElements, silent);
	}

	/**
	 * Set the "nextElement" property by calling
	 * {@link #setProperty(String, JavaScriptObject, boolean)}. To have more
	 * informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setNextElements(Element[] nextElements, boolean silent) {
		setProperty("nextElement", JsArrayUtil
				.convertElementToJsArray(nextElements), silent);
	}

	/**
	 * Get the "nextElement" property by calling {@link #getJsNextElements()}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public Element[] getNextElements() {
		return JsArrayUtil.convertJsToElementArray(getJsNextElements());
	}

	/**
	 * Get the value of "nextElement" property. A simple reference to the
	 * javascript object is returned.
	 */
	private native JavaScriptObject getJsNextElements() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getProperty("nextElement");
	                   }-*/;

	/**
	 * Add an element to the "prevElement" list. To have more informations about
	 * this property, please see http://billwscott.com/carousel/#properties.
	 */
	public void addPrevElement(Element prevElement, boolean silent) {
		JavaScriptObject prevElements = getJsPrevElements();
		JsArrayUtil.addElementInJsArray(prevElements, prevElement);
		setProperty("prevElement", prevElements, silent);
	}

	/**
	 * Remove an element from the "prevElement" list. To have more informations
	 * about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void removePrevElement(Element prevElement, boolean silent) {
		JavaScriptObject prevElements = getJsPrevElements();
		JsArrayUtil.removeElementInJsArray(prevElements, prevElement);
		setProperty("prevElement", prevElements, silent);
	}

	/**
	 * Set the "prevElement" property by calling
	 * {@link #setProperty(String, JavaScriptObject, boolean)}. To have more
	 * informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public void setPrevElements(Element[] prevElements, boolean silent) {
		setProperty("prevElement", JsArrayUtil
				.convertElementToJsArray(prevElements), silent);
	}

	/**
	 * Get the "prevElement" property by calling {@link #getJsPrevElements()}.
	 * To have more informations about this property, please see
	 * http://billwscott.com/carousel/#properties.
	 */
	public Element[] getPrevElements() {
		return JsArrayUtil.convertJsToElementArray(getJsPrevElements());
	}

	/**
	 * Get the value of "prevElement" property. A simple reference to the
	 * javascript object is returned.
	 */
	private native JavaScriptObject getJsPrevElements() /*-{
	                   return this.@com.gwtyuicarousel.client.ui.Carousel::javascriptObject.getProperty("prevElement");
	                   }-*/;

	/**
	 * Get a reference to the YAHOO.extension.Carousel javascript object.
	 */
	public JavaScriptObject getJavaScriptObject() {
		return javascriptObject;
	}

}